import QtQuick 2.0

Rectangle{

    id: item
    radius: itemRadius

    property string title: ""

    property bool selected: false
    property bool isHovered: false
    property bool isPressed: false

    signal clicked(var title)

    height: itemSize; width: height
    color: selected ? item_color_selected : item_color

    Text{
        font.pixelSize: config.fontsize
        font.bold: item.selected
        text: item.title
        color: item.selected ? text_color_selected : text_color
        anchors.centerIn: parent
    }
    Rectangle{
        opacity: item.isPressed ? 0.1 : 0.05
        color: "black"
        radius: itemRadius
        anchors.fill: parent
        visible: item.isHovered && config.hoverEnabled
    }

    MouseArea{
        anchors.fill: parent
        cursorShape: Qt.PointingHandCursor
        hoverEnabled: config.hoverEnabled
        onExited: {
            item.isHovered = false
        }onEntered: {
            item.isHovered = true
        }onPressed: {
            item.isPressed = true
        }onReleased: {
            item.isPressed = false
        }

        onClicked: {
            item.clicked(title)
        }
    }
}
